UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'smo8PFUbm0/29Bs8vGKAAasUxLIvJztmEZrbUqwcIZY='
WHERE
key_id = 'bdfa06054845f136a529a077ddc3fcafed44b8562f501a6c0c6aa2bd7a969a70'
AND (
token = 'smo8PFUbm0/29Bs8vGKAAasUxLIvJztmEZrbUqwcIZY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)