UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyWe+c9kwyaVkod4kHt3QRTnSs2ZtBOOgHCQVkizVkc=' 
WHERE 
  key_id = '1a9358ae50328e0b06f703481b4efa9b3ab145cf75e40c8472d437f1471b2b47' 
  AND (
    token = 'qyWe+c9kwyaVkod4kHt3QRTnSs2ZtBOOgHCQVkizVkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034