UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v1yiHUDCO1xf1nzpxXQpGgkbuyvfey1phaXMT1L9nnY='
WHERE
key_id = '45e8e4a2df18ae800b4a46ed069dbc480a905a4de899b852a18567d76ced70c9'
AND (
token = 'v1yiHUDCO1xf1nzpxXQpGgkbuyvfey1phaXMT1L9nnY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)