UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aZIpfl7QECgkFfjSqulpe3/U1e+vSUxAroc6vBYp3gE='
WHERE
key_id = 'f373d460b529f2bc0c086b0b2e8e75c91d3e9b509eb2330f524a9d78c212e59e'
AND (
token = 'aZIpfl7QECgkFfjSqulpe3/U1e+vSUxAroc6vBYp3gE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)