UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0BP9qB4VkLrE6NBAXvV5z9pr84mO2z0n+zRNbrNpa4w=' 
WHERE 
  key_id = '400edea547ba7bcb4c9fb1254e4219e4d5244137531610bbdfa062e459684f79' 
  AND (
    token = '0BP9qB4VkLrE6NBAXvV5z9pr84mO2z0n+zRNbrNpa4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030