UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LKsgsmetT1xNPdn8yZsPYuio7DRPf/n5mqvaRZq+CSk=' 
WHERE 
  key_id = '397c0f4886a7384e0e594db9c2a8b68101e145c5820f2be4f86f065790044c09' 
  AND (
    token = 'LKsgsmetT1xNPdn8yZsPYuio7DRPf/n5mqvaRZq+CSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027