UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QbYRqDtgpoqAmDdC0CrirBeeVUK3UNju9k9bIamJY90=' 
WHERE 
  key_id = '6115c47b5c134d23280a11c69725c88f4ecba55a986bc6f271a3e05d64288696' 
  AND (
    token = 'QbYRqDtgpoqAmDdC0CrirBeeVUK3UNju9k9bIamJY90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035