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