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