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