UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BsWXaGhVOknyhkJeVwr0yo2Z1K2Mq+tlNDYgKzwH0vY='
WHERE
key_id = 'c54d82fe4ece72defbe3c7302b367d2c82b847568ed3ffd8f9ac872e5e27481f'
AND (
token = 'BsWXaGhVOknyhkJeVwr0yo2Z1K2Mq+tlNDYgKzwH0vY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)