UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z9N+8rzEpWMKIRfRPisC4X/iAPk+na3yOD1bdX6Z7Yo='
WHERE
key_id = 'cffa963b995d7dcf89304cdfb4da07ea071808b5687b76d1bf7cea206dab4c6a'
AND (
token = 'Z9N+8rzEpWMKIRfRPisC4X/iAPk+na3yOD1bdX6Z7Yo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)