UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0jy6psfNGGBdJPFPzIvGKUvAa3B039Zrw6Q4+KeW3GQ=' 
WHERE 
  key_id = '35c51cdd9ced15e82533f6ac3e1eb25db690b1577297fbcfc158d1b7713c235e' 
  AND (
    token = '0jy6psfNGGBdJPFPzIvGKUvAa3B039Zrw6Q4+KeW3GQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025