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