UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FQPPqpIIYzC455+ZQQfxigQOym/M47FrWh01YdOkBd8='
WHERE
key_id = '407a8c790fadb0bd20b17c3fb06f0dd6bff4a89dba3fe099081da3404f38bd3d'
AND (
token = 'FQPPqpIIYzC455+ZQQfxigQOym/M47FrWh01YdOkBd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)