UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yA0ZQTJ6O2/s2QJTvV9IUkULqGRNcN9QS46JfTZYK/g='
WHERE
key_id = 'dc22da47b15077cbc38e35d3e541d0f6444be0ab341e4b1822c46d093e46b9dd'
AND (
token = 'yA0ZQTJ6O2/s2QJTvV9IUkULqGRNcN9QS46JfTZYK/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)