UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8319x0VN7EgcxVKZgdrveVoY3BDRP0gJnkqP2Z9niVo='
WHERE
key_id = 'bae5c2e97337d4b8eed5e9df82b3748b753ccd10dcecbf9cfbce2532db457a1c'
AND (
token = '8319x0VN7EgcxVKZgdrveVoY3BDRP0gJnkqP2Z9niVo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)