UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6aMTRXxyt4C0UHK23oabWvVUq75TX7TShPQwXYOZWCs=' 
WHERE 
  key_id = 'f25fc4ae90a6101c3af7b5150e0e175f9a26d37cdafb4c5873b1c9e20a67e881' 
  AND (
    token = '6aMTRXxyt4C0UHK23oabWvVUq75TX7TShPQwXYOZWCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083