UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7twYbmmT+MZtPFP/Z2jDSmfzIl1CXcj5vG9lAp47RuU='
WHERE
key_id = '9c165692557cc529a865f33353fe16ac707f92e53b308835ffcc279b6289513c'
AND (
token = '7twYbmmT+MZtPFP/Z2jDSmfzIl1CXcj5vG9lAp47RuU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)