UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NmqqaHZkNf1We7NjnNMrj6n/418kmgHPcCmZ6hq4vfQ='
WHERE
key_id = 'c2343438ac2c05da079bf4fae8562965753217e013e3cbe6a88418b94bdf80b8'
AND (
token = 'NmqqaHZkNf1We7NjnNMrj6n/418kmgHPcCmZ6hq4vfQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)