UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1jhjU1GKYw8b/Spa7KUAauBIJplCplZUd6TN+zU3Ro='
WHERE
key_id = '9736381f9497c9f3e96e664c8a028e52ce1560eed8a5d4a052642f9cbe562f1f'
AND (
token = 'B1jhjU1GKYw8b/Spa7KUAauBIJplCplZUd6TN+zU3Ro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)