UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lYHABET2Msj9C/0ZNVJ3UB1VIyPSgJFRMEwtlvnMUZs='
WHERE
key_id = 'b574282482df987142cf4167487dd361036f2471e4194d452fa5cd6274ae807c'
AND (
token = 'lYHABET2Msj9C/0ZNVJ3UB1VIyPSgJFRMEwtlvnMUZs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)