UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EwA/0gdtuIJk+qAbPLPRovY0XoxCcEadNCwhyJ5a4yE='
WHERE
key_id = 'a746ea8781133ffc4a95814ee2cdb3d9e4e0b05355b06d182d324cd43bce9c13'
AND (
token = 'EwA/0gdtuIJk+qAbPLPRovY0XoxCcEadNCwhyJ5a4yE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)