UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z+0IH4SzagNPzSw0mFaIfMsmub2/IogMbliC/YUdeF4=' 
WHERE 
  key_id = '57d930779bde83ab518eebbf5cbde13981eeaeb8fb781633b1769a6458c7a02b' 
  AND (
    token = 'z+0IH4SzagNPzSw0mFaIfMsmub2/IogMbliC/YUdeF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053