UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bdoHK1PAJ2S0j+Eddb5tPxVLSCX4iEnSpqOOtO41AIY=' 
WHERE 
  key_id = '2a85d08eb8421cf6598f25d3b731b42f254d2d8d49e37e83a1cd534497186041' 
  AND (
    token = 'bdoHK1PAJ2S0j+Eddb5tPxVLSCX4iEnSpqOOtO41AIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043