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