UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'isBGPs3z792QtwE/s4fkGvfmPZ0/I9ym4spr9pf3Yk8=' 
WHERE 
  key_id = '41986d663b33b239802bef2629358faad2e4d35ec379ecc2d3da90c197fafc7c' 
  AND (
    token = 'isBGPs3z792QtwE/s4fkGvfmPZ0/I9ym4spr9pf3Yk8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048