UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '389GA99ezPX7MxiwMxWoGao7BKEfunZ1hf8DBdSpFg0='
WHERE
key_id = 'b24b2a30fade38c7f4f82e0828519d47686bd102d1cad62b8edfea268e445d45'
AND (
token = '389GA99ezPX7MxiwMxWoGao7BKEfunZ1hf8DBdSpFg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)