UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Odo/fpN14GMaT2fq4ddTpK08gqIpGP0mto22pGnq0Xc=' 
WHERE 
  key_id = '587f2cfc000fc42dde3d4c3e20cd9bccd7ad8af12680111acfaa4990bc7899d5' 
  AND (
    token = 'Odo/fpN14GMaT2fq4ddTpK08gqIpGP0mto22pGnq0Xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045