UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5chP5wy/f/41xXTaWYTZlWtatMwbnEjk0Zo8ex+w+6g='
WHERE
key_id = '4e727c2a79f465a797ccb557eda741047e2d91745786c852cd6d45ccb31ea8af'
AND (
token = '5chP5wy/f/41xXTaWYTZlWtatMwbnEjk0Zo8ex+w+6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)