UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aB9jz4m7NreSjd8+zA37pP9ZPV7RUCNonjwEgCekLj0='
WHERE
key_id = '9540dbc7ebe7224a1b574a425a0ffac55ede72dcb9763f966731d21d55bfe8c0'
AND (
token = 'aB9jz4m7NreSjd8+zA37pP9ZPV7RUCNonjwEgCekLj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)