UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SJ0CLDl+o1j72XBUw+o5ky77NiWS8MOBMDO7xHEtUYw='
WHERE
key_id = 'e592ff09eab380fb8379398f6a269820c2cca3410a5b668ab548b8f5e16d4d65'
AND (
token = 'SJ0CLDl+o1j72XBUw+o5ky77NiWS8MOBMDO7xHEtUYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)