UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0BqpKOGAzGsh3ZpZCntpC48thRvzJEIJyx+u0Q6gJ8U=' 
WHERE 
  key_id = '09341ee5cba07579f34a8184e308d670b3f836e321540742ed35f4409478bc85' 
  AND (
    token = '0BqpKOGAzGsh3ZpZCntpC48thRvzJEIJyx+u0Q6gJ8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021