UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ANjL8C6+vo2Thw6jlCOmd4l+IBKcYBuT6tzOySqhJs=' 
WHERE 
  key_id = '3b8f7caa675ddf8db7a1f9e474174f6e3c1c457b2d25a546a813d4f034a0fa5d' 
  AND (
    token = '7ANjL8C6+vo2Thw6jlCOmd4l+IBKcYBuT6tzOySqhJs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051