UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j+A9971WPWXtu6nUQNxelvkkRuAeUZobuJDtYjwKrIA='
WHERE
key_id = 'b740e012a73d9a213f5c0cd0bc48ee952552817a1848a582acb7421792c07149'
AND (
token = 'j+A9971WPWXtu6nUQNxelvkkRuAeUZobuJDtYjwKrIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)