UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IYsHk7OiZjP3m1QOgy1jb0bqzumwsKgei5Fah7RYmco='
WHERE
key_id = 'ed8cfbfd374e5affad83d46344e26fcc5b45eee36bc1ecd9b784b90d38eff045'
AND (
token = 'IYsHk7OiZjP3m1QOgy1jb0bqzumwsKgei5Fah7RYmco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)